package com.eling.elcms.travel.model;

import com.eling.elcms.core.dao.annotation.CriteriaEnhancer;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancers;
import com.eling.elcms.core.dao.annotation.In;
import com.eling.elcms.core.dao.hibernate.OrderCriteriaEnhancer;
import com.eling.elcms.core.dao.hibernate.search.EnumBridge;
import com.eling.elcms.core.model.BaseModel;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.Indexed;

import javax.persistence.*;

/**
 * 费用抵扣规则
 * 
 * @author linjizeng
 *
 */
@Entity
@Table(name = "travel_settlementsrule")
@Indexed
@CriteriaEnhancers(criteriaEnhancers = { @CriteriaEnhancer(impl = OrderCriteriaEnhancer.class) })
public class SettlementsRule extends BaseModel {

	private static final long serialVersionUID = -8393470929221662750L;

	@Id
	@DocumentId
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@In
	private Long pkSettlementsRule;

	/** 名称 */
	@Column
	@Field
	private String name;

	/** 类型 */
	@Enumerated(EnumType.STRING)
	@Field
	@In
	@FieldBridge(impl = EnumBridge.class)
	private RuleType type;

	/** 公式 */
	@Column
	@Field
	private String formula;

	/** 描述 */
	@Column
	@Field
	private String description;

	/** 对应实现类 */
	@Column
	@Field
	private String serviceImpl;

	@Version
	private Integer version;

	public Long getPkSettlementsRule() {
		return pkSettlementsRule;
	}

	public void setPkSettlementsRule(Long pkSettlementsRule) {
		this.pkSettlementsRule = pkSettlementsRule;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public RuleType getType() {
		return type;
	}

	public void setType(RuleType type) {
		this.type = type;
	}

	public String getFormula() {
		return formula;
	}

	public void setFormula(String formula) {
		this.formula = formula;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getServiceImpl() {
		return serviceImpl;
	}

	public void setServiceImpl(String serviceImpl) {
		this.serviceImpl = serviceImpl;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

}
